// 图书借阅信息
<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%"
      v-loading="isLoading"
      element-loading-text="数据正在加载中"
      element-loading-spinner="el-icon-loading"
      :default-sort="{ prop: 'date', order: 'descending' }"
    >
      <!-- <el-table-column
      prop="index"
      label=""
      sortable
      width="180">
    </el-table-column> -->
      <el-table-column label="姓名" prop="xm"> </el-table-column>
      <el-table-column label="学号" prop="xh"> </el-table-column>
      <el-table-column label="图书编号" prop="tsbh"> </el-table-column>
      <el-table-column label="图书名称" prop="tsmc"> </el-table-column>
      <el-table-column label="图书状态" prop="status">
        <template slot-scope="scope">
          <span v-show="scope.row.status == 1">已还</span>
          <span v-show="scope.row.status == 2">待还</span>
          <span v-show="scope.row.status == 3">逾期</span>
        </template>
      </el-table-column>
      <el-table-column label="借阅时间" prop="jysj"> </el-table-column>
      <el-table-column label="应还时间" prop="yhsj"> </el-table-column>
      <el-table-column label="实际归还时间" prop="sjghsj"> </el-table-column>
      <el-table-column label="是否欠费" prop="sfqf"> </el-table-column>
      <el-table-column label="应罚金额" prop="yfje"> </el-table-column>
      <el-table-column label="实罚额" prop="sfje"> </el-table-column>
      <el-table-column label="已交欠费" prop="yjqf"> </el-table-column>
      <el-table-column label="遗失赔偿金额" prop="yspcje"> </el-table-column>
    </el-table>
    <div class="flexRight">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[10, 15, 20, 30, 40]"
        :page-size="size"
        :layout="mylayout"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import '../../utils/isShowTotalNumber.js'
export default {
  name: "LibraryLendingdata",
  data() {
    return {
      isLoading: true,
      tableData: [],
      total: 0,
      size: 15,
      currentPage: 1,
      schoolCode: "",
    };
  },
  created() {
    this.schoolCode = JSON.parse(sessionStorage.getItem("school")).school_code;
    this.getResultData(this.currentPage, this.size);
        this.mylayout = window.mylayout
    // var roleId = JSON.parse(localStorage.getItem("USER")).roleId;
    // if (roleId.includes("99")) {
    //   this.mylayout = "sizes, prev, pager, next, jumper";
    // } else {
    //   this.mylayout = "total, sizes, prev, pager, next, jumper";
    // }
  },
  mounted() {},
  methods: {
    handleSizeChange(val) {
      this.size = val;
      this.isLoading = true;
      this.getResultData(this.currentPage, val);
    },
    handleCurrentChange(val) {
      this.isLoading = true;
      this.currentPage = val;
      this.getResultData(val, this.size);
    },
    getResultData() {
      let param = {
        xxdm: this.schoolCode,
        currentPage: this.currentPage,
        size: this.size,
        orderField: ["jysj"],
        isAsc: "desc",
      };
      this.$post2("dataCenter/select/listTSJYB", JSON.stringify(param)).then(
        (r) => {
          this.tableData = r.data.records;
          this.total = r.data.total;
          this.isLoading = false;
        }
      );
    },
  },
};
</script>





